<template>
    <div class="footer-bar">
        <div class="footer-bar__item " @click="handleTabSelect(1)">
            <!-- <i class="home-active"></i>
            <div class="text-active">首页</div> -->
            <i v-bind:class="activeIndex== 1?'home-active':'home-normal'"></i>
            <div v-bind:class="activeIndex== 1?'text-active':'text-normal'">首页</div>
        </div>
        <div class="footer-bar__item " @click="handleTabSelect(2)">
            <!-- <i class="user-normal"></i>
            <div class="text-normal">个人中心</div> -->
            <i v-bind:class="activeIndex== 2?'user-active':'user-normal'"></i>
            <div  v-bind:class="activeIndex== 2?'text-active':'text-normal'">个人中心</div>
        </div>
    </div>
</template>
<script>
export default {
    name: "footerbar",
    data() {
        return {
            activeIndex: 1,
        }
    },
    created() {
        this.activeIndex = this.$store.state.navbar.barActive
    },
    methods: {
        handleTabSelect (index){
            if(index===1) {
                this.$store.commit("SET_ACTIVE", 1)
                this.$router.push('/')
            } else if(index===2) {
                this.$store.commit('SET_ACTIVE', 2)
                this.$router.push('/user/center')
            }
        }
    }
}
</script>